<?xml version="1.0" encoding="UTF-8"?>

<!-- 
FDT: device identification transformation for Profibus device identification xml files
-->
<xsl:transform 	xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
		xmlns:str="http://xsltsl.org/string" 
		xmlns:ident="x-schema:DTMIdentSchema.xml"
		xmlns:fdt="x-schema:FDTDataTypesSchema.xml"
		xmlns:scanident="x-schema:DTMScanIdentSchema.xml"
		xmlns:devident="x-schema:DTMDeviceTypeIdentSchema.xml"
		xmlns:pbident="x-schema:FDTProfibusIdentSchema.xml"
		xmlns:pbdevice="x-schema:FDTProfibusDeviceTypeIdentSchema.xml"
		xmlns:pbscan="x-schema:FDTProfibusScanIdentSchema.xml" version="2.0">
		<!-- 
FDT: version of this file
	-->

	<xsl:variable name="FileVersion">
		<xsl:number value="1.211"/>
	</xsl:variable>
	<xsl:output method="xml" omit-xml-declaration="yes" indent="yes"/>
<!-- 
root: transform device or scan identification
-->
	<xsl:template match="/">
			<xsl:apply-templates select="//pbscan:ScanIdentifications"/>
			<xsl:apply-templates select="//pbdevice:DeviceIdentifications"/>
	</xsl:template>
<!-- 
profibus identification list
-->
	<xsl:template match="pbdevice:DeviceIdentifications">
		<xsl:text disable-output-escaping="yes">&lt;?xml version="1.0"?&gt;
	&lt;!-- This file is created by FDTxxxIdentTransformation.xsl after transformation of xxxDTMDeviceIdentificationInstance.xml --&gt;
	&lt;FDT xmlns="x-schema:DTMDeviceTypeIdentSchema.xml" 
	 xmlns:ident="x-schema:DTMIdentSchema.xml" xmlns:fdt="x-schema:FDTDataTypesSchema.xml" &gt;</xsl:text>
				<xsl:element name="DeviceIdentifications">
					<xsl:apply-templates select="pbdevice:DeviceIdentification_DP"/>
					<xsl:apply-templates select="pbdevice:DeviceIdentification_IM"/>
					<xsl:apply-templates select="pbdevice:DeviceIdentification_PA"/>
				</xsl:element>
		<xsl:text disable-output-escaping="yes">&lt;/FDT&gt;</xsl:text>
	</xsl:template>
<!-- 
profibus DP catalog identifcation
-->
	<xsl:template match="pbdevice:DeviceIdentification_DP">
			<xsl:element name="DeviceIdentification">
				<xsl:attribute name="ident:idDTMSupportLevel">
					<xsl:value-of select="@pbident:idDTMSupportLevel"/>
				</xsl:attribute>
				<xsl:element name="IdBusProtocol">
					<xsl:attribute name="ident:protocolSpecificName">Profibus DP</xsl:attribute>
					<xsl:attribute name="ident:value">
						<xsl:value-of select="pbdevice:IdBusProtocol/@pbident:busProtocol"/>
					</xsl:attribute>
				</xsl:element>				
				<xsl:element name="IdBusProtocolVersion">
					<xsl:attribute name="ident:protocolSpecificName">not applicable</xsl:attribute>
				</xsl:element>
				<xsl:element name="IdManufacturer">
					<xsl:attribute name="ident:protocolSpecificName">not applicable</xsl:attribute>
				</xsl:element>
				<xsl:apply-templates select="pbdevice:IdTypeID"/>
				<xsl:element name="IdSoftwareRevision" >
					<xsl:attribute name="ident:protocolSpecificName">not applicable</xsl:attribute>
				</xsl:element>
				<xsl:element name="IdHardwareRevision" >
					<xsl:attribute name="ident:protocolSpecificName">not applicable</xsl:attribute>
				</xsl:element>
				<xsl:element name="IdValues">
					<xsl:apply-templates select="pbdevice:ManufacturerSpecificExtension"/>
				</xsl:element>
			</xsl:element>
	</xsl:template>
<!-- 
DP scan identifcation
-->
	<xsl:template match="pbscan:ScanIdentification_DP">
			<xsl:element name="ScanIdentification">
				<xsl:apply-templates select="@configuredState" />
				<xsl:apply-templates select="fdt:CommunicationError"/>
				<xsl:element name="IdBusProtocol">
					<xsl:attribute name="ident:protocolSpecificName">Profibus DP</xsl:attribute>
					<xsl:attribute name="ident:value">
						<xsl:value-of select="pbscan:IdBusProtocol/@pbident:busProtocol"/>
					</xsl:attribute>
				</xsl:element>
				<xsl:apply-templates select="pbscan:IdBusProtocol"/>
				<xsl:element name="IdBusProtocolVersion">
					<xsl:attribute name="ident:protocolSpecificName">not applicable</xsl:attribute>
				</xsl:element>
				<xsl:apply-templates select="pbscan:IdAddress"/>			
				<xsl:element name="IdManufacturer">
					<xsl:attribute name="ident:protocolSpecificName">not applicable</xsl:attribute>
				</xsl:element>
				<xsl:apply-templates select="pbscan:IdTypeID"/>
				<xsl:element name="IdSoftwareRevision" >
					<xsl:attribute name="ident:protocolSpecificName">not applicable</xsl:attribute>
				</xsl:element>
				<xsl:element name="IdHardwareRevision" >
					<xsl:attribute name="ident:protocolSpecificName">not applicable</xsl:attribute>
				</xsl:element>
				<xsl:element name="IdDeviceTag">
					<xsl:attribute name="ident:protocolSpecificName">not applicable</xsl:attribute>
				</xsl:element>
				<xsl:element name="IdSerialNumber">
					<xsl:attribute name="ident:protocolSpecificName">not applicable</xsl:attribute>
				</xsl:element>
				<xsl:element name="IdValues">
					<xsl:apply-templates select="pbscan:ManufacturerSpecificExtension"/>
				</xsl:element>
			</xsl:element>
	</xsl:template>
<!-- 
profibus IM catalog identifcation
-->
	<xsl:template match="pbdevice:DeviceIdentification_IM">
			<xsl:element name="DeviceIdentification">
				<xsl:attribute name="ident:idDTMSupportLevel">
					<xsl:value-of select="@pbident:idDTMSupportLevel"/>
				</xsl:attribute>
				<xsl:element name="IdBusProtocol">
					<xsl:attribute name="ident:protocolSpecificName">Profibus IM</xsl:attribute>
					<xsl:attribute name="ident:value">
						<xsl:value-of select="pbdevice:IdBusProtocol/@pbident:busProtocol"/>
					</xsl:attribute>
				</xsl:element>
				<xsl:element name="IdBusProtocolVersion">
					<xsl:attribute name="ident:protocolSpecificName">not applicable</xsl:attribute>
				</xsl:element>
				<xsl:apply-templates select="pbdevice:Manufacturer_id"/>
				<xsl:apply-templates select="pbdevice:IdTypeID"/>
				<xsl:apply-templates select="pbdevice:IdSoftwareRevision"/>
				<xsl:apply-templates select="pbdevice:IdHardwareRevision"/>
				<xsl:element name="IdValues">
					<xsl:apply-templates select="pbdevice:order_id"/>
					<xsl:apply-templates select="pbdevice:ProfileID"/>
					<xsl:apply-templates select="pbdevice:ImVersion"/>
					<xsl:apply-templates select="pbdevice:ProfileSpecificType"/>
					<xsl:apply-templates select="pbdevice:ImSupported"/>
					<xsl:apply-templates select="pbdevice:ManufacturerSpecificExtension"/>
				</xsl:element>
			</xsl:element>
	</xsl:template>
<!-- 
profibus IM scan identifcation
-->
	<xsl:template match="pbscan:ScanIdentification_IM">
			<xsl:element name="ScanIdentification">
				<xsl:apply-templates select="@configuredState" />
				<xsl:apply-templates select="fdt:CommunicationError"/>
				<xsl:element name="IdBusProtocol">
					<xsl:attribute name="ident:protocolSpecificName">Profibus IM</xsl:attribute>
					<xsl:attribute name="ident:value">
						<xsl:value-of select="pbscan:IdBusProtocol/@pbident:busProtocol"/>
					</xsl:attribute>
				</xsl:element>
				<xsl:element name="IdBusProtocolVersion">
					<xsl:attribute name="ident:protocolSpecificName">not applicable</xsl:attribute>
				</xsl:element>
				<xsl:apply-templates select="pbscan:IdAddress"/>			
				<xsl:apply-templates select="pbscan:Manufacturer_id"/>
				<xsl:apply-templates select="pbscan:IdTypeID"/>
				<xsl:apply-templates select="pbscan:IdSoftwareRevision"/>
				<xsl:apply-templates select="pbscan:IdHardwareRevision"/>
				<xsl:element name="IdDeviceTag">
					<xsl:attribute name="ident:protocolSpecificName">not applicable</xsl:attribute>
				</xsl:element>			
				<xsl:element name="IdSerialNumber">
					<xsl:attribute name="ident:protocolSpecificName">not applicable</xsl:attribute>
				</xsl:element>				
				<xsl:element name="IdValues">
					<xsl:apply-templates select="pbscan:order_id"/>
					<xsl:apply-templates select="pbscan:ProfileID"/>
					<xsl:apply-templates select="pbscan:ImVersion"/>
					<xsl:apply-templates select="pbscan:ProfileSpecificType"/>
					<xsl:apply-templates select="pbscan:ImSupported"/>
					<xsl:apply-templates select="pbscan:ManufacturerSpecificExtension"/>
				</xsl:element>
			</xsl:element>
	</xsl:template>

<!-- 
profibus PA catalog identifcation
-->
	<xsl:template match="pbdevice:DeviceIdentification_PA">
			<xsl:element name="DeviceIdentification">
				<xsl:attribute name="ident:idDTMSupportLevel">
					<xsl:value-of select="@pbident:idDTMSupportLevel"/>
				</xsl:attribute>
				<xsl:element name="IdBusProtocol">
					<xsl:attribute name="ident:protocolSpecificName">Profile</xsl:attribute>
					<xsl:attribute name="ident:value">
						<xsl:value-of select="pbdevice:IdBusProtocol/@pbident:busProtocol"/>
					</xsl:attribute>
				</xsl:element>
				<xsl:apply-templates select="pbdevice:ProfileRevisionPA"/>
				<xsl:apply-templates select="pbdevice:Device_man_id"/>
				<xsl:apply-templates select="pbdevice:IdTypeID"/>
				<xsl:apply-templates select="pbdevice:IdSoftwareRevisionPA"/>
				<xsl:apply-templates select="pbdevice:IdHardwareRevisionPA"/>
				<xsl:element name="IdValues">
					<xsl:apply-templates select="pbdevice:Device_id"/>
					<xsl:apply-templates select="pbdevice:ProfileSpecificTypePA"/>
					<xsl:apply-templates select="pbdevice:ManufacturerSpecificExtension"/>
				</xsl:element>
			</xsl:element>
	</xsl:template>
<!-- 
profibus PA scan identifcation
-->
	<xsl:template match="pbscan:ScanIdentification_PA">
			<xsl:element name="ScanIdentification">
				<xsl:apply-templates select="@configuredState" />
				<xsl:apply-templates select="fdt:CommunicationError"/>
				<xsl:element name="IdBusProtocol">
					<xsl:attribute name="ident:protocolSpecificName">Profile</xsl:attribute>
					<xsl:attribute name="ident:value">
						<xsl:value-of select="pbscan:IdBusProtocol/@pbident:busProtocol"/>
					</xsl:attribute>
				</xsl:element>
				<xsl:apply-templates select="pbscan:ProfileRevisionPA"/>
				<xsl:apply-templates select="pbscan:IdAddress"/>			
				<xsl:apply-templates select="pbscan:Device_man_id"/>
				<xsl:apply-templates select="pbscan:IdTypeID"/>
				<xsl:apply-templates select="pbscan:IdSoftwareRevisionPA"/>
				<xsl:apply-templates select="pbscan:IdHardwareRevisionPA"/>
				<xsl:apply-templates select="pbscan:IdTag"/>
				<xsl:apply-templates select="pbscan:IdSerialNumber"/>
				<xsl:element name="IdValues">
					<xsl:apply-templates select="pbscan:Device_id"/>
					<xsl:apply-templates select="pbscan:ProfileSpecificTypePA"/>
					<xsl:apply-templates select="pbscan:ManufacturerSpecificExtension"/>
				</xsl:element>
			</xsl:element>
	</xsl:template>
	
<!-- 
scan list
-->
	<xsl:template match="pbscan:ScanIdentifications">
			<xsl:text disable-output-escaping="yes">&lt;?xml version="1.0"?&gt;
	&lt;!-- This file is created by FDTxxxIdentTransformation.xsl after transformation of xxxDTMScanIdentificationInstance.xml --&gt;&lt;FDT xmlns="x-schema:DTMScanIdentSchema.xml" 
	 xmlns:ident="x-schema:DTMIdentSchema.xml" xmlns:fdt="x-schema:FDTDataTypesSchema.xml" &gt;</xsl:text>
				<xsl:element name="ScanIdentifications">
					<xsl:attribute name="fdt:busCategory">
						<xsl:value-of select="@fdt:busCategory"/>
					</xsl:attribute>
					<xsl:attribute name="resultState">
						<xsl:value-of select="@resultState"/>
					</xsl:attribute>
					<xsl:apply-templates select="pbscan:ScanIdentification_DP"/>
					<xsl:apply-templates select="pbscan:ScanIdentification_IM"/>
					<xsl:apply-templates select="pbscan:ScanIdentification_PA"/>
				</xsl:element>
		<xsl:text disable-output-escaping="yes">&lt;/FDT&gt;</xsl:text>
	</xsl:template>

<!-- 
configured attribute
-->
	<xsl:template match="@configuredState">
		<xsl:attribute name="configuredState">
			<xsl:value-of select="."/>
		</xsl:attribute>
	</xsl:template>

<!-- 
device tag
-->
	<xsl:template match="pbscan:IdTag">
		<xsl:element name="IdDeviceTag">
			<xsl:attribute name="ident:value"><xsl:value-of select="@pbident:deviceTAG"/></xsl:attribute>
			<xsl:attribute name="ident:protocolSpecificName">TAG_DESC</xsl:attribute>
		</xsl:element>
	</xsl:template>
<!-- 
communicationError
-->
	<xsl:template match="fdt:CommunicationError">
		<xsl:element name="fdt:CommunicationError">
			<xsl:attribute name="communicationError"><xsl:value-of select="@communicationError"/></xsl:attribute>
			<xsl:attribute name="tag"><xsl:value-of select="@tag"/></xsl:attribute>
		</xsl:element>
	</xsl:template>
<!-- 
serialnumber
-->
	<xsl:template match="pbscan:IdSerialNumber">
		<xsl:element name="IdSerialNumber">
			<xsl:attribute name="ident:value"><xsl:value-of select="@pbident:serialNumber"/></xsl:attribute>
			<xsl:attribute name="ident:protocolSpecificName">DEVICE_SER_NUM</xsl:attribute>
		</xsl:element>
	</xsl:template>
<!-- 
busaddress
-->
	<xsl:template match="pbscan:IdAddress">
		<xsl:element name="IdAddress">
			<xsl:attribute name="ident:value"><xsl:value-of select="@pbident:slaveAddress"/></xsl:attribute>
			<xsl:attribute name="ident:protocolSpecificName">Slave Address</xsl:attribute>
		</xsl:element>
	</xsl:template>

<!-- 
Device_id, saved as protocol specific value
-->
	<xsl:template match="pbdevice:Device_id">
		<xsl:param name="value" select="@pbident:device_id"/>
		<xsl:element name="IdValue">
			<xsl:attribute name="ident:name">DEVICE_ID</xsl:attribute>
			<xsl:attribute name="ident:protocolSpecificName">DEVICE_ID</xsl:attribute>
			<xsl:call-template name="genMatch">
				<xsl:with-param name="value" select="$value"/>
			</xsl:call-template>
		</xsl:element>
	</xsl:template>
	<xsl:template match="pbscan:Device_id">
		<xsl:element name="IdValue">
			<xsl:attribute name="ident:protocolSpecificName">DEVICE_ID</xsl:attribute>
			<xsl:attribute name="ident:name">DEVICE_ID</xsl:attribute>
			<xsl:attribute name="ident:value">
				<xsl:value-of select="@pbident:device_id"/>
			</xsl:attribute>
		</xsl:element>
	</xsl:template>
<!-- 
DeviceType, saved as protocol specific value
-->
	<xsl:template match="pbdevice:DeviceType">
		<xsl:param name="value" select="@pbident:devicetype"/>
		<xsl:element name="IdValue">
			<xsl:attribute name="ident:protocolSpecificName">IDENT_NUMBER</xsl:attribute>
			<xsl:attribute name="ident:name">IDENT_NUMBER</xsl:attribute>
			<xsl:call-template name="genMatch">
				<xsl:with-param name="value" select="$value"/>
			</xsl:call-template>
		</xsl:element>
	</xsl:template>
	<xsl:template match="pbscan:DeviceType">
		<xsl:element name="IdValue">
			<xsl:attribute name="ident:protocolSpecificName">IDENT_NUMBER</xsl:attribute>
			<xsl:attribute name="ident:name">IDENT_NUMBER</xsl:attribute>
			<xsl:attribute name="ident:value">
				<xsl:value-of select="@pbident:devicetype"/>
			</xsl:attribute>
		</xsl:element>
	</xsl:template>
	
<!-- 
YearOfFirmware, saved as protocol specific value
-->
	<xsl:template match="pbdevice:YearOfFirmware">
		<xsl:param name="value" select="@pbident:yearOfFirmware"/>
		<xsl:element name="IdValue">
			<xsl:attribute name="ident:protocolSpecificName">Date of Firmware (Year)</xsl:attribute>
			<xsl:attribute name="ident:name">YearOfFirmware</xsl:attribute>
			<xsl:call-template name="genMatch">
				<xsl:with-param name="value" select="$value"/>
			</xsl:call-template>
		</xsl:element>
	</xsl:template>
	<xsl:template match="pbscan:YearOfFirmware">
		<xsl:element name="IdValue">
			<xsl:attribute name="ident:protocolSpecificName">Date of Firmware (Year)</xsl:attribute>
			<xsl:attribute name="ident:name">YearOfFirmware</xsl:attribute>
			<xsl:attribute name="ident:value">
				<xsl:value-of select="@pbident:yearOfFirmware"/>
			</xsl:attribute>
		</xsl:element>
	</xsl:template>
	
<!-- 
ProfileRevisionPA
-->
	<xsl:template match="pbdevice:ProfileRevisionPA">
		<xsl:param name="manid" select="@pbident:profileRevisionPA"/>
		<xsl:element name="IdBusProtocolVersion">
			<xsl:attribute name="ident:protocolSpecificName">Profile Revision</xsl:attribute>
			<xsl:call-template name="genMatch">
				<xsl:with-param name="value" select="$manid"/>
			</xsl:call-template>
		</xsl:element>
	</xsl:template>
	<xsl:template match="pbscan:ProfileRevisionPA">
		<xsl:element name="IdBusProtocolVersion">
			<xsl:attribute name="ident:protocolSpecificName">Profile Revision</xsl:attribute>
			<xsl:attribute name="ident:value">
				<xsl:value-of select="@pbident:profileRevisionPA"/>
			</xsl:attribute>
		</xsl:element>
	</xsl:template>
	
<!-- 
DayMonthOfFirmware, saved as protocol specific value
-->
	<xsl:template match="pbdevice:DayMonthOfFirmware">
		<xsl:param name="value" select="@pbident:dayMonthOfFirmware"/>
		<xsl:element name="IdValue">
			<xsl:attribute name="ident:protocolSpecificName">Date of Firmware (Day/Month)</xsl:attribute>
			<xsl:attribute name="ident:name">DayMonthOfFirmware</xsl:attribute>
			<xsl:call-template name="genMatch">
				<xsl:with-param name="value" select="$value"/>
			</xsl:call-template>
		</xsl:element>
	</xsl:template>
	<xsl:template match="pbscan:DayMonthOfFirmware">
		<xsl:element name="IdValue">
			<xsl:attribute name="ident:protocolSpecificName">Date of Firmware (Day/Month)</xsl:attribute>
			<xsl:attribute name="ident:name">DayMonthOfFirmware</xsl:attribute>
			<xsl:attribute name="ident:value">
				<xsl:value-of select="@pbident:dayMonthOfFirmware"/>
			</xsl:attribute>
		</xsl:element>
	</xsl:template>
	
<!-- 
ProfileNumber, saved as protocol specific value
-->
	<xsl:template match="pbdevice:ProfileNumber">
		<xsl:param name="value" select="@pbident:profileNumber"/>
		<xsl:element name="IdValue">
			<xsl:attribute name="ident:protocolSpecificName">Profile Number</xsl:attribute>
			<xsl:attribute name="ident:name">ProfileNumber</xsl:attribute>
			<xsl:call-template name="genMatch">
				<xsl:with-param name="value" select="$value"/>
			</xsl:call-template>
		</xsl:element>
	</xsl:template>
	<xsl:template match="pbscan:ProfileNumber">
		<xsl:element name="IdValue">
			<xsl:attribute name="ident:protocolSpecificName">Profile Number</xsl:attribute>
			<xsl:attribute name="ident:name">ProfileNumber</xsl:attribute>
			<xsl:attribute name="ident:value">
				<xsl:value-of select="@pbident:profileNumber"/>
			</xsl:attribute>
		</xsl:element>
	</xsl:template>
	
<!-- 
ProfileSpecificTypePA, saved as protocol specific value
-->
	<xsl:template match="pbdevice:ProfileSpecificTypePA">
		<xsl:param name="value" select="@pbident:profileSpecificTypePA"/>
		<xsl:element name="IdValue">
			<xsl:attribute name="ident:protocolSpecificName">BO PARENT_CLASS</xsl:attribute>
			<xsl:attribute name="ident:name">ProfileSpecificTypePA</xsl:attribute>
			<xsl:call-template name="genMatch">
				<xsl:with-param name="value" select="$value"/>
			</xsl:call-template>
		</xsl:element>
	</xsl:template>
	<xsl:template match="pbscan:ProfileSpecificTypePA">
		<xsl:element name="IdValue">
			<xsl:attribute name="ident:protocolSpecificName">BO PARENT_CLASS</xsl:attribute>
			<xsl:attribute name="ident:name">ProfileSpecificTypePA</xsl:attribute>
			<xsl:attribute name="ident:value">
				<xsl:value-of select="@pbident:profileSpecificTypePA"/>
			</xsl:attribute>
		</xsl:element>
	</xsl:template>
	
<!-- 
Order_id, saved as protocol specific value
-->
	<xsl:template match="pbdevice:Order_id">
		<xsl:param name="value" select="@pbident:order_id"/>
		<xsl:element name="IdValue">
			<xsl:attribute name="ident:protocolSpecificName">ORDER_ID</xsl:attribute>
			<xsl:attribute name="ident:name">Order_id</xsl:attribute>
			<xsl:call-template name="genMatch">
				<xsl:with-param name="value" select="$value"/>
			</xsl:call-template>
		</xsl:element>
	</xsl:template>
	<xsl:template match="pbscan:Order_id">
		<xsl:element name="IdValue">
			<xsl:attribute name="ident:protocolSpecificName">ORDER_ID</xsl:attribute>
			<xsl:attribute name="ident:name">Order_id</xsl:attribute>
			<xsl:attribute name="ident:value">
				<xsl:value-of select="@pbident:order_id"/>
			</xsl:attribute>
		</xsl:element>
	</xsl:template>
	
<!-- 
ProfileID, saved as protocol specific value
-->
	<xsl:template match="pbdevice:ProfileID">
		<xsl:param name="value" select="@pbident:profileID"/>
		<xsl:element name="IdValue">
			<xsl:attribute name="ident:protocolSpecificName">PROFILE_ID</xsl:attribute>
			<xsl:attribute name="ident:name">ProfileID</xsl:attribute>
			<xsl:call-template name="genMatch">
				<xsl:with-param name="value" select="$value"/>
			</xsl:call-template>
		</xsl:element>
	</xsl:template>
	<xsl:template match="pbscan:ProfileID">
		<xsl:element name="IdValue">
			<xsl:attribute name="ident:protocolSpecificName">PROFILE_ID</xsl:attribute>
			<xsl:attribute name="ident:name">ProfileID</xsl:attribute>
			<xsl:attribute name="ident:value">
				<xsl:value-of select="@pbident:profileID"/>
			</xsl:attribute>
		</xsl:element>
	</xsl:template>
<!-- 
ProfileSpecificType, saved as protocol specific value
-->
	<xsl:template match="pbdevice:ProfileSpecificType">
		<xsl:param name="value" select="@pbident:profileSpecificType"/>
		<xsl:element name="IdValue">
			<xsl:attribute name="ident:protocolSpecificName">PROFILE_SPECIFIC_TYPE</xsl:attribute>
			<xsl:attribute name="ident:name">ProfileSpecificType</xsl:attribute>
			<xsl:call-template name="genMatch">
				<xsl:with-param name="value" select="$value"/>
			</xsl:call-template>
		</xsl:element>
	</xsl:template>
	<xsl:template match="pbscan:ProfileSpecificType">
		<xsl:element name="IdValue">
			<xsl:attribute name="ident:protocolSpecificName">PROFILE_SPECIFIC_TYPE</xsl:attribute>
			<xsl:attribute name="ident:name">ProfileSpecificType</xsl:attribute>
			<xsl:attribute name="ident:value">
				<xsl:value-of select="@pbident:profileSpecificType"/>
			</xsl:attribute>
		</xsl:element>
	</xsl:template>
	
<!-- 
ImVersion, saved as protocol specific value
-->
	<xsl:template match="pbdevice:ImVersion">
		<xsl:param name="value" select="@pbident:imVersion"/>
		<xsl:element name="IdValue">
			<xsl:attribute name="ident:protocolSpecificName">IM_VERSION</xsl:attribute>
			<xsl:attribute name="ident:name">ImVersion</xsl:attribute>
			<xsl:call-template name="genMatch">
				<xsl:with-param name="value" select="$value"/>
			</xsl:call-template>
		</xsl:element>
	</xsl:template>
	<xsl:template match="pbscan:ImVersion">
		<xsl:element name="IdValue">
			<xsl:attribute name="ident:protocolSpecificName">IM_VERSION</xsl:attribute>
			<xsl:attribute name="ident:name">ImVersion</xsl:attribute>
			<xsl:attribute name="ident:value">
				<xsl:value-of select="@pbident:imVersion"/>
			</xsl:attribute>
		</xsl:element>
	</xsl:template>
	
<!-- 
ImSupported, saved as protocol specific value
-->
	<xsl:template match="pbdevice:ImSupported">
		<xsl:param name="value" select="@pbident:imSupported"/>
		<xsl:element name="IdValue">
			<xsl:attribute name="ident:protocolSpecificName">IM_SUPPORTED</xsl:attribute>
			<xsl:attribute name="ident:name">ImSupported</xsl:attribute>
			<xsl:call-template name="genMatch">
				<xsl:with-param name="value" select="$value"/>
			</xsl:call-template>
		</xsl:element>
	</xsl:template>
	<xsl:template match="pbscan:ImSupported">
		<xsl:element name="IdValue">
			<xsl:attribute name="ident:protocolSpecificName">IM_SUPPORTED</xsl:attribute>
			<xsl:attribute name="ident:name">ImSupported</xsl:attribute>
			<xsl:attribute name="ident:value">
				<xsl:value-of select="@pbident:imSupported"/>
			</xsl:attribute>
		</xsl:element>
	</xsl:template>
	
<!-- 
Manufacturer
-->
<xsl:template match="pbdevice:Manufacturer_id">
		<xsl:param name="manid" select="@pbident:manufacturer_id"/>
		<xsl:element name="IdManufacturer">
			<xsl:attribute name="ident:protocolSpecificName">Manufacturer</xsl:attribute>
			<xsl:call-template name="genMatch">
				<xsl:with-param name="value" select="$manid"/>
			</xsl:call-template>
		</xsl:element>
	</xsl:template>
	<xsl:template match="pbscan:Manufacturer_id">
		<xsl:element name="IdManufacturer">
			<xsl:attribute name="ident:protocolSpecificName">Manufacturer</xsl:attribute>
			<xsl:attribute name="ident:value">
				<xsl:value-of select="@pbident:manufacturer_id"/>
			</xsl:attribute>
		</xsl:element>
	</xsl:template>
	
<!-- 
Manufacturer
-->
	<xsl:template match="pbdevice:Device_man_id">
		<xsl:param name="manid" select="@pbident:device_man_id"/>
		<xsl:element name="IdManufacturer">
			<xsl:attribute name="ident:protocolSpecificName">MANUFACTURER_ID</xsl:attribute>
			<xsl:call-template name="genMatch">
				<xsl:with-param name="value" select="$manid"/>
			</xsl:call-template>
		</xsl:element>
	</xsl:template>
	<xsl:template match="pbscan:Device_man_id">
		<xsl:element name="IdManufacturer">
			<xsl:attribute name="ident:protocolSpecificName">MANUFACTURER_ID</xsl:attribute>
			<xsl:attribute name="ident:value">
				<xsl:value-of select="@pbident:device_man_id"/>
			</xsl:attribute>
		</xsl:element>
	</xsl:template>
	


	
<!-- 
device type
-->
	<xsl:template match="pbdevice:IdTypeID">
		<xsl:param name="value" select="@pbident:identNumber"/>
		<xsl:element name="IdTypeID">
			<xsl:attribute name="ident:protocolSpecificName">IDENT_NUMBER</xsl:attribute>
			<xsl:call-template name="genMatch">
				<xsl:with-param name="value" select="$value"/>
			</xsl:call-template>
		</xsl:element>
	</xsl:template>
	<xsl:template match="pbscan:IdTypeID">
		<xsl:element name="IdTypeID">
			<xsl:attribute name="ident:protocolSpecificName">IDENT_NUMBER</xsl:attribute>
			<xsl:attribute name="ident:value">
				<xsl:value-of select="@pbident:identNumber"/>
			</xsl:attribute>
		</xsl:element>
	</xsl:template>

<!-- 
software revision
-->
	<xsl:template match="pbdevice:IdSoftwareRevision">
		<xsl:param name="value" select="@pbident:softwareRevision"/>
		<xsl:element name="IdSoftwareRevision">
			<xsl:attribute name="ident:protocolSpecificName">SOFTWARE_REVISION</xsl:attribute>
			<xsl:call-template name="genMatch">
				<xsl:with-param name="value" select="$value"/>
			</xsl:call-template>
		</xsl:element>
	</xsl:template>
		<xsl:template match="pbscan:IdSoftwareRevision">
		<xsl:param name="value" select="@pbident:softwareRevision"/>
		<xsl:element name="IdSoftwareRevision">
			<xsl:attribute name="ident:protocolSpecificName">SOFTWARE_REVISION</xsl:attribute>
			<xsl:call-template name="genMatch">
				<xsl:with-param name="value" select="$value"/>
			</xsl:call-template>
		</xsl:element>
	</xsl:template>
	
<!-- 
profiDrive version
-->
	<xsl:template match="pbdevice:Version">
		<xsl:param name="value" select="@pbident:version"/>
		<xsl:element name="IdSoftwareRevision">
			<xsl:attribute name="ident:protocolSpecificName">SOFTWARE_REVISION</xsl:attribute>
			<xsl:call-template name="genMatch">
				<xsl:with-param name="value" select="$value"/>
			</xsl:call-template>
		</xsl:element>
	</xsl:template>
		<xsl:template match="pbscan:Version">
		<xsl:param name="value" select="@pbident:version"/>
		<xsl:element name="IdSoftwareRevision">
			<xsl:attribute name="ident:protocolSpecificName">SOFTWARE_REVISION</xsl:attribute>
			<xsl:call-template name="genMatch">
				<xsl:with-param name="value" select="$value"/>
			</xsl:call-template>
		</xsl:element>
	</xsl:template>
	
<!-- 
software revision PA
-->
	<xsl:template match="pbdevice:IdSoftwareRevisionPA">
		<xsl:param name="value" select="@pbident:softwareRevisionPA"/>
		<xsl:element name="IdSoftwareRevision">
			<xsl:attribute name="ident:protocolSpecificName">SOFTWARE_REVISION</xsl:attribute>
			<xsl:call-template name="genMatch">
				<xsl:with-param name="value" select="$value"/>
			</xsl:call-template>
		</xsl:element>
	</xsl:template>
		<xsl:template match="pbscan:IdSoftwareRevisionPA">
		<xsl:param name="value" select="@pbident:softwareRevisionPA"/>
		<xsl:element name="IdSoftwareRevision">
			<xsl:attribute name="ident:protocolSpecificName">SOFTWARE_REVISION</xsl:attribute>
			<xsl:call-template name="genMatch">
				<xsl:with-param name="value" select="$value"/>
			</xsl:call-template>
		</xsl:element>
	</xsl:template>

<!-- 
hardware revision
-->
	<xsl:template match="pbdevice:IdHardwareRevision">
		<xsl:param name="value" select="@pbident:hardwareRevision"/>
		<xsl:element name="IdHardwareRevision">
			<xsl:attribute name="ident:protocolSpecificName">HARDWARE_REVISION</xsl:attribute>
			<xsl:call-template name="genMatch">
				<xsl:with-param name="value" select="$value"/>
			</xsl:call-template>
		</xsl:element>
	</xsl:template>
		<xsl:template match="pbscan:IdHardwareRevision">
		<xsl:param name="value" select="@pbident:hardwareRevision"/>
		<xsl:element name="IdHardwareRevision">
			<xsl:attribute name="ident:protocolSpecificName">HARDWARE_REVISION</xsl:attribute>
			<xsl:call-template name="genMatch">
				<xsl:with-param name="value" select="$value"/>
			</xsl:call-template>
		</xsl:element>
	</xsl:template>
	
<!-- 
hardware revision PA
-->
	<xsl:template match="pbdevice:IdHardwareRevisionPA">
		<xsl:param name="value" select="@pbident:hardwareRevisionPA"/>
		<xsl:element name="IdHardwareRevision">
			<xsl:attribute name="ident:protocolSpecificName">HARDWARE_REVISION</xsl:attribute>
			<xsl:call-template name="genMatch">
				<xsl:with-param name="value" select="$value"/>
			</xsl:call-template>
		</xsl:element>
	</xsl:template>
		<xsl:template match="pbscan:IdHardwareRevisionPA">
		<xsl:param name="value" select="@pbident:hardwareRevisionPA"/>
		<xsl:element name="IdHardwareRevision">
			<xsl:attribute name="ident:protocolSpecificName">HARDWARE_REVISION</xsl:attribute>
			<xsl:call-template name="genMatch">
				<xsl:with-param name="value" select="$value"/>
			</xsl:call-template>
		</xsl:element>
	</xsl:template>

<!-- 
ManufacturerSpecificExtension
--> 
	<xsl:template match="pbdevice:ManufacturerSpecificExtension">
		<xsl:param name="value" select="@pbident:manufacturerSpecificExtension"/>
		<xsl:element name="IdValue">
			<xsl:attribute name="ident:name">ManufacturerSpecificExtension</xsl:attribute>
			<xsl:call-template name="genMatch">
				<xsl:with-param name="value" select="$value"/>
			</xsl:call-template>
			<xsl:attribute name="ident:protocolSpecificName">ManufacturerSpecificExtension</xsl:attribute>
		</xsl:element>
	</xsl:template>
	<xsl:template match="pbscan:ManufacturerSpecificExtension">
		<xsl:element name="IdValue">
			<xsl:attribute name="ident:name">ManufacturerSpecificExtension</xsl:attribute>
			<xsl:attribute name="ident:value">
				<xsl:value-of select="@pbident:manufacturerSpecificExtension"/>
			</xsl:attribute>
			<xsl:attribute name="ident:protocolSpecificName">ManufacturerSpecificExtension</xsl:attribute>
		</xsl:element>
	</xsl:template>


<!-- 
generate matching information
-->
	<xsl:template name="genMatch">
		<xsl:param name="value"/>
		<xsl:param name="empty"/>
		<xsl:if test="$value!=$empty">
			<xsl:attribute name="ident:value"><xsl:value-of select="$value"/></xsl:attribute>
		</xsl:if>
		<xsl:apply-templates select="pbident:RegExpr"/>
	</xsl:template>
	
<!-- 
generate regular exressions
-->
	<xsl:template match="pbident:RegExpr">
		<!-- copy pattern info -->
		<xsl:call-template name="genPattern">
			<xsl:with-param name="match" select="@match"/>
			<xsl:with-param name="nomatch" select="@nomatch"/>
		</xsl:call-template>
	</xsl:template>
	
<!-- 
generate pattern information
-->
	<xsl:template name="genPattern">
		<xsl:param name="match"/>
		<xsl:param name="nomatch"/>
		<xsl:param name="empty"/>
		<xsl:choose>
		<xsl:when test="$match!=$empty">
			<xsl:element name="ident:RegExpr">
				<xsl:attribute name="match"><xsl:value-of select="$match"/></xsl:attribute>
				<xsl:if test="$nomatch!=$empty">
					<xsl:attribute name="nomatch"><xsl:value-of select="$nomatch"/></xsl:attribute>
				</xsl:if>
			</xsl:element>
		</xsl:when>
		<xsl:when test="$nomatch!=$empty">
			<xsl:element name="ident:RegExpr">
				<xsl:attribute name="nomatch"><xsl:value-of select="$nomatch"/></xsl:attribute>
				<xsl:if test="$match!=$empty">
					<xsl:attribute name="match"><xsl:value-of select="$match"/></xsl:attribute>
				</xsl:if>
			</xsl:element>
		</xsl:when>
		</xsl:choose>
	</xsl:template>
</xsl:transform>
